<script setup>
  import { provide, ref } from 'vue';
import ParentCom from './components/ParentCom.vue';
  // 依赖注入第一步, 祖辈提供数据
  const count = ref(0)
  const countPlus = () => {
    count.value ++
  }
  provide('myCount', count)
  provide('myCountFn', countPlus)
</script>

<template>
  <h1>祖辈</h1>
  <div>{{ count }}</div>
  <ParentCom />
</template>

<style lang="scss">
.box {
  padding: 20px;
  margin: 10px;
  border: 1px solid salmon;
}
</style>
